﻿using System.Web.Mvc;
using Actya.Core.Infrastructure;
using Actya.Web.ViewModels;
using Actya.Core.SiteStructure;

namespace Actya.Web.Controllers
{
	public class PageController : Controller
	{
		private readonly ICmsContext _cmsContext;

		public PageController(ICmsContext cmsContext)
		{
			_cmsContext = cmsContext;
		}

		public ActionResult Page()
		{
			var page = _cmsContext.Page;
			return View(new PageViewModel { Title = page.Title, Content = page.Content });
		}

		public ActionResult Home()
		{
			var page = _cmsContext.Page;
			return View(new PageViewModel { Title = page.Title, Content = page.Content });
		}

		public ActionResult NotFound()
		{
			var result = View();
			Response.StatusCode = 404;
			Response.TrySkipIisCustomErrors = true;
			return result;
		}
	}
}
